package com.htjc.integral.passouter.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.htjc.integral.common.annotation.InvokeLog;
import com.htjc.integral.interactionouter.service.IInvokeService;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import lombok.extern.slf4j.Slf4j;

/**
 * @author jingliang
 * @date 2018/11/07
 */
@Slf4j(topic="passOuterLogger")
@RestController
@RequestMapping({"/outer/InvokeController"})
public class InvokeController {


    @Reference(version = "${dubbo.version}",
            application = "${dubbo.application.id}"
    )
    private IInvokeService iInvokeService;

	@InvokeLog(value="强隔离内外网穿透",params={"data","wsdurl"})
	@RequestMapping(value = {"/invokeQuery"}, produces = {"text/json;charset=UTF-8;"})
    public String invokeQuery(@RequestBody String params) {
		log.info(InvokeController.class.getName()+"方法名：invokeQuery()调用渠道端外网应用积分e+外网服务接口=====start=====");

//    	params = "{\"wsdurl\":\"100.1.40.58:17002/integral-interaction-inner/invokeController/invokeQuery\",\"data\":\"<ROOT><PROVINCE_CODE>330000</PROVINCE_CODE><WSDL_URL>http://10.147.249.205:8280/qdxt/pf_webservice/spptws/lsspureWs/service</WSDL_URL><TARGET_NAME_SPACE>http://service.ws.sp.sppt.lsspure</TARGET_NAME_SPACE><METHOD>invoke</METHOD><SER_PATH>cimsb/cimsb/manage/service/consImBalService</SER_PATH><SER_METHOD_NAME>getImBal</SER_METHOD_NAME><USER_NAME>DZJF</USER_NAME><PASS_WORD>zpepc001</PASS_WORD><DATA><![CDATA[<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><DBSET><R><C N=\\\"srvCode\\\">LSSP_000180</C><C N=\\\"channelCode\\\">ESGCC</C><C N=\\\"acctId\\\">00099096</C><C N=\\\"consNo\\\">1313706203</C><C N=\\\"orgNo\\\">33101</C></R></DBSET>]]></DATA></ROOT>\"}";
    	JSONObject json = JSON.parseObject(params);
    	String result = iInvokeService.invokeQuery(json.toString());
    	
    	log.info(InvokeController.class.getName()+"方法名：invokeQuery()调用渠道端外网应用积分e+外网服务接口=====end====="+result);
        return result;
    }



}
